<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$q=$_GET['q'];
$sql="SELECT id,name,custom_field1 FROM ".TB_PREFIX."customers WHERE name LIKE '".$q."%' OR name LIKE '% ".$q."%' ORDER BY name LIMIT 5";
$names=dbQuery($sql);
 
for($i=0;$name = $names->fetch();$i++) {
   $rows[$i]['name']=$name['name'];
   $rows[$i]['id']=$name['id'];
   $rows[$i]['custom_field1']=$name['custom_field1'];
 }
echo json_encode($rows);
